/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package impss;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mikehood
 */
@Entity
@Table(name = "phone")
@NamedQueries({@NamedQuery(name = "Phone.findAll", query = "SELECT p FROM Phone p"), @NamedQuery(name = "Phone.findByPhoneID", query = "SELECT p FROM Phone p WHERE p.phoneID = :phoneID"), @NamedQuery(name = "Phone.findByPhoneName", query = "SELECT p FROM Phone p WHERE p.phoneName = :phoneName"), @NamedQuery(name = "Phone.findByPhoneColor", query = "SELECT p FROM Phone p WHERE p.phoneColor = :phoneColor"), @NamedQuery(name = "Phone.findByPhoneMaterial", query = "SELECT p FROM Phone p WHERE p.phoneMaterial = :phoneMaterial"), @NamedQuery(name = "Phone.findByPhoneView", query = "SELECT p FROM Phone p WHERE p.phoneView = :phoneView"), @NamedQuery(name = "Phone.findByPhoneInfo", query = "SELECT p FROM Phone p WHERE p.phoneInfo = :phoneInfo"), @NamedQuery(name = "Phone.findByPhoneSum", query = "SELECT p FROM Phone p WHERE p.phoneSum = :phoneSum"), @NamedQuery(name = "Phone.findByPhonePrice", query = "SELECT p FROM Phone p WHERE p.phonePrice = :phonePrice"), @NamedQuery(name = "Phone.findByDesignGoal", query = "SELECT p FROM Phone p WHERE p.designGoal = :designGoal"), @NamedQuery(name = "Phone.findByDesignState", query = "SELECT p FROM Phone p WHERE p.designState = :designState")})
public class Phone implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "phoneID")
    private Integer phoneID;
    @Column(name = "phoneName")
    private String phoneName;
    @Column(name = "phoneColor")
    private String phoneColor;
    @Column(name = "phoneMaterial")
    private String phoneMaterial;
    @Column(name = "phoneView")
    private String phoneView;
    @Column(name = "phoneInfo")
    private String phoneInfo;
    @Column(name = "phoneSum")
    private Integer phoneSum;
    @Column(name = "phonePrice")
    private Integer phonePrice;
    @Column(name = "designGoal")
    private String designGoal;
    @Column(name = "designState")
    private Short designState;
    @JoinTable(name = "structure", joinColumns = {@JoinColumn(name = "phoneID", referencedColumnName = "phoneID")}, inverseJoinColumns = {@JoinColumn(name = "accessoryID", referencedColumnName = "accessoryID")})
    @ManyToMany
    private Collection<Accessory> accessoryCollection;
    @JoinColumn(name = "designerID", referencedColumnName = "designerID")
    @ManyToOne
    private Designer designerID;
    @OneToMany(mappedBy = "phoneID")
    private Collection<Buy> buyCollection;
    @OneToMany(mappedBy = "phoneID")
    private Collection<Produce> produceCollection;

    public Phone() {
    }

    public Phone(Integer phoneID) {
        this.phoneID = phoneID;
    }

    public Integer getPhoneID() {
        return phoneID;
    }

    public void setPhoneID(Integer phoneID) {
        this.phoneID = phoneID;
    }

    public String getPhoneName() {
        return phoneName;
    }

    public void setPhoneName(String phoneName) {
        this.phoneName = phoneName;
    }

    public String getPhoneColor() {
        return phoneColor;
    }

    public void setPhoneColor(String phoneColor) {
        this.phoneColor = phoneColor;
    }

    public String getPhoneMaterial() {
        return phoneMaterial;
    }

    public void setPhoneMaterial(String phoneMaterial) {
        this.phoneMaterial = phoneMaterial;
    }

    public String getPhoneView() {
        return phoneView;
    }

    public void setPhoneView(String phoneView) {
        this.phoneView = phoneView;
    }

    public String getPhoneInfo() {
        return phoneInfo;
    }

    public void setPhoneInfo(String phoneInfo) {
        this.phoneInfo = phoneInfo;
    }

    public Integer getPhoneSum() {
        return phoneSum;
    }

    public void setPhoneSum(Integer phoneSum) {
        this.phoneSum = phoneSum;
    }

    public Integer getPhonePrice() {
        return phonePrice;
    }

    public void setPhonePrice(Integer phonePrice) {
        this.phonePrice = phonePrice;
    }

    public String getDesignGoal() {
        return designGoal;
    }

    public void setDesignGoal(String designGoal) {
        this.designGoal = designGoal;
    }

    public Short getDesignState() {
        return designState;
    }

    public void setDesignState(Short designState) {
        this.designState = designState;
    }

    public Collection<Accessory> getAccessoryCollection() {
        return accessoryCollection;
    }

    public void setAccessoryCollection(Collection<Accessory> accessoryCollection) {
        this.accessoryCollection = accessoryCollection;
    }

    public Designer getDesignerID() {
        return designerID;
    }

    public void setDesignerID(Designer designerID) {
        this.designerID = designerID;
    }

    public Collection<Buy> getBuyCollection() {
        return buyCollection;
    }

    public void setBuyCollection(Collection<Buy> buyCollection) {
        this.buyCollection = buyCollection;
    }

    public Collection<Produce> getProduceCollection() {
        return produceCollection;
    }

    public void setProduceCollection(Collection<Produce> produceCollection) {
        this.produceCollection = produceCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (phoneID != null ? phoneID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Phone)) {
            return false;
        }
        Phone other = (Phone) object;
        if ((this.phoneID == null && other.phoneID != null) || (this.phoneID != null && !this.phoneID.equals(other.phoneID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "impss.Phone[phoneID=" + phoneID + "]";
    }

}
